<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\UserSearcher */
/* @var $dataProvider yii\data\ActiveDataProvider */
$name = backend\models\Admin::getCTableName();
$this->title = $name.'管理';
//$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">

    <h1><?php echo $this->title?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('新建'.$name, ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?=
    GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
//            'id',
            'username',
//            'auth_key',
//            'password_hash',
//            'password_reset_token',
            'email:email',
//             'status',
//            'academy',
            [
                "attribute" => "created_at",
                "format" => ["date", "php:Y-m-d H:i:s"],
            ],
            [
                "attribute" => 'updated_at',
                "format" => ["date", "php:Y-m-d H:i:s"],
            ],
            ['class' => 'yii\grid\ActionColumn',
                'template' => '{view} {update} {delete} {reset}',
                'buttons' => [
                    'reset' => function ($url, $model, $key) {
                        $options = array_merge([
                            'title' => "重设密码",
                            'aria-label' => '重设密码',
                            'data-pjax' => '重设密码',
                                ]);
                        return Html::a('<span class="glyphicon glyphicon-retweet"></span>', $url, $options);
                    },
                        ],
                    ],
                ],
            ]);
            ?>
</div>
